package com.zqxq.lottery.api.controller;

import com.zqxq.common.constant.Result;
import com.zqxq.lottery.api.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.bo.product.ProductBO;
import com.zqxq.lottery.entity.vo.user.UserProductVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "用户商品接口",tags = "用户商品接口")
@RestController
@Slf4j
@RequestMapping(value = "/userProduct", produces = "application/json")
public class UserProductController {

    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;

    @ApiOperation(value = "用户商品-兑换列表", notes="用户商品-兑换列表")
    @PostMapping("/page")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query", dataType = "Long"),
            @ApiImplicitParam(name = "status", value = "订单状态", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "pageNo", value = "页码", required = false, paramType = "query", dataType = "Integer", defaultValue = "1"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", required = false, paramType = "query", dataType = "Integer", defaultValue = "10")
    })
    public Result queryUserProductPage(Long userId,Integer status,Integer pageNo,Integer pageSize){
        return lotteryServerFeignClient.queryUserProductPage(userId,status,pageNo,pageSize);
    }

    @ApiOperation(value = "用户商品-兑换详情", notes="用户商品-兑换详情")
    @PostMapping("/get")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tradeId", value = "兑换ID", required = true, paramType = "query", dataType = "String")
    })
    public Result getUserProduct(String tradeId){
        return lotteryServerFeignClient.getUserProduct(tradeId);
    }
}
